package pattern.structrual.composite;

/**
 * @Author Gavin
 * @date 2020.07.17 10:49
 */
public class Leaf extends Component {
    private String name;

    public Leaf(String name) {
        this.name = name;
    }

    @Override
    void doOperation() {
        throw new UnsupportedOperationException();
    }

    @Override
    void add(Component component) {
        throw new UnsupportedOperationException();
    }

    @Override
    void remove(Component component) {
        throw new UnsupportedOperationException();
    }

    @Override
    Component getChild(int i) {
        return null;
    }

    @Override
    public void print(int level) {
        for (int i = 0; i < level; i++) {
            System.out.print("--");
        }
        System.out.println("left:" + name);
    }
}
